package Scuttlebutt;

import java.lang.*;
import javax.swing.event.*;
import java.io.*;

public class TreeListener implements TreeSelectionListener 
{
	Scuttlebutt parent = null;
	public TreeListener(Scuttlebutt parent)
	{
		this.parent = parent;
	}

	public void valueChanged(TreeSelectionEvent t0)
	{
		SortableNode node = (SortableNode)parent.getProject().getTree().getLastSelectedPathComponent();
    	if((node != null) && (node.getNodePath() != null)){
	    	File path = new File(node.getNodePath());
	    	if(path != null){
		    	if(path.isFile()){
		   		 	parent.getEditPane().Open(path.getPath());
		   		 	parent.SaveProject();
		    	}
	    	}
	    	
	    	path = null;
    	}
	}
}
